//
//  ReceiptCardView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/12.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "ReceiptCardView.h"
#import <Masonry.h>
#import "UIView+AZGradient.h"
@implementation ReceiptCardView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    
    self.backgroundColor = [UIColor colorWithRed:242 / 255.0 green:244 / 255.0 blue:246 / 255.0 alpha:1];

    
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.height.mas_equalTo(226);
    }];
    
    
    self.bankCardView = [[UIView alloc] init];
    [self.topView addSubview:self.bankCardView];
    [self.bankCardView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(-20);
        make.top.mas_equalTo(20);
        make.height.mas_equalTo(120);
    }];
    
    [self.bankCardView az_setGradientBackgroundWithColors:@[[UIColor colorWithRed:255.0 / 255.0 green:133.0 / 255.0 blue:111.0 / 255.0 alpha:1],[UIColor colorWithRed:248.0 / 255.0 green:90 / 255.0 blue:81 / 255.0 alpha:1]] locations:nil startPoint:CGPointMake(0,0) endPoint:CGPointMake(1,0)];
    
    self.bankNameLab = [[UILabel alloc] init];
    self.bankNameLab.text = @"工商银行";
    self.bankNameLab.textColor = [UIColor whiteColor];
    self.bankNameLab.font = [UIFont systemFontOfSize:16];
    [self.bankCardView addSubview:self.bankNameLab];
    [self.bankNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(20);
    }];
    
    self.bankNameValueLab = [[UILabel alloc] init];
    self.bankNameValueLab.text = @"储蓄卡";
    self.bankNameValueLab.textColor = [UIColor whiteColor];
    self.bankNameValueLab.font = [UIFont systemFontOfSize:14];
    [self.bankCardView addSubview:self.bankNameValueLab];
    [self.bankNameValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.centerY.equalTo(self.bankNameLab);
    }];
    
    
    
    self.bankCardNumValueLab = [[UILabel alloc] init];
    self.bankCardNumValueLab.text = @"6235";
    self.bankCardNumValueLab.textAlignment = NSTextAlignmentCenter;
    self.bankCardNumValueLab.textColor = [UIColor whiteColor];
    self.bankCardNumValueLab.font = [UIFont systemFontOfSize:20];
    [self.bankCardView addSubview:self.bankCardNumValueLab];
    [self.bankCardNumValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.bankCardView).offset(60);
        make.bottom.equalTo(self.bankCardView).offset(-30);
    }];
    
    self.pointImv = [[UIImageView alloc] init];
    self.pointImv.image = [UIImage imageNamed:@"card_icon_smallcircle"];
    [self.bankCardView addSubview:self.pointImv];
    [self.pointImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.bankCardNumValueLab.mas_left).offset(-20);
        make.centerY.equalTo(self.bankCardNumValueLab);
    }];
    
    
    self.tipsLab = [[UILabel alloc] init];
    self.tipsLab.text = @"交易将全部结算至此账户";
    self.tipsLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.tipsLab.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.tipsLab];
    [self.tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.bankCardView.mas_bottom).offset(36);
    }];
    
    /*
    self.arrowImv = [[UIImageView alloc] init];
    self.arrowImv.image = [UIImage imageNamed:@"me_icon_arrow_right"];
    [self.topView addSubview:self.arrowImv];
    [self.arrowImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.tipsLab);
        make.right.mas_equalTo(-15);
        make.width.mas_equalTo(16);
        make.height.mas_equalTo(16);
    }];
    
    self.changeReceiptCardBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.changeReceiptCardBtn setTitle:@"修改收款卡" forState:(UIControlStateNormal)];
    [self.changeReceiptCardBtn setTitleColor:[UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    self.changeReceiptCardBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.topView addSubview:self.changeReceiptCardBtn];
    [self.changeReceiptCardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.arrowImv.mas_left);
        make.centerY.equalTo(self.arrowImv);
    }];
     */
    
    
}

@end
